
import Vue from "vue";

const componentsWatcher = (scanner) => {
  scanner.keys().map((key) => {
    let name = scanner(key).default.name;
    if (name) {
      Vue.component(name, scanner(key).default);
    }
  });
};
const vueScanner = require.context(
  "@/components",
  true,
  /^\.\/((?!\/)[\s\S])+\/index\.vue$/
);
componentsWatcher(vueScanner);
